﻿<%@ WebHandler Language="C#" Class="Apollo.Website.SetupAsync" %>

using System;
using System.Data.Common;
using System.Linq;
using System.Web;
using NHibernate;
using NHibernate.Dialect;
using NHibernate.Linq;


namespace Apollo.Website
{
    public class SetupAsync : IHttpHandler, System.Web.SessionState.IRequiresSessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            try
            {
                Setup.SetupHepler.ExecuteSetupAction(context, (Setup.SetupAction)int.Parse(context.Request["code"]));
            }
            catch (Exception ex) {
                context.Response.Write(@"{ ""status"": ""Failed"", ""message"": ""Action failed! Reason: "+ ex.Message +@""" }");
            }
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }

    }
}